package pack0604;

import jdk.swing.interop.SwingInterOpUtils;

import java.sql.SQLOutput;
import java.util.Scanner;

public class DemoE {
    public static void main(String[] args) {
        String name1 = "张三";
        String name2 = "张三";
        String name3 = new String("张三");
        System.out.println(name1 == name2);
        System.out.println(name1 == name3);
        System.out.println(name1.equals(name3));
        //System.out.println(name1.equals(name3)); --用于字符串比较

        int year = 2019;
        //(条件表达式)?值1;值2 --条件表达式
        String str = (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) ? "闰年" : "平年";
        System.out.println(str);

        //字符串比较
        Scanner sun = new Scanner(System.in);
        System.out.println("请输入任意键: ");
        String a = sun.next();
        boolean flag  =("y".equals(a)||"Y".equals(a)); //比较两个字符串内容是否相等(不区分y的大小写)
        System.out.println(flag);

        System.out.println("请输入标识: ");
        String b= sun.next();
        flag=(a.equals(b));
        System.out.println(flag);


    }
}
